home *** CD-ROM | disk | FTP | other *** search
- Path: dawn.mmm.com!news
- From: kjhopps@mmm.com (Kevin J Hopps)
- Newsgroups: comp.lang.c++
- Subject: Re: Cast from function expecting a reference to one expecting a pointer
- Date: 8 Feb 1996 14:36:24 GMT
- Organization: 3M - St. Paul, MN 55144-1000 US
- Message-ID: <4fd1p8$hf3@dawn.mmm.com>
- References: <310DF504.69E6@tees.ac.uk> <4f8dui$kik@druid.borland.com>
- Reply-To: kjhopps@mmm.com
- X-Newsreader: TIN [version 1.2 PL2]
-
- Pete Becker (pete@borland.com) wrote:
- > In article <310DF504.69E6@tees.ac.uk>, H.Lawson@tees.ac.uk says...
- > >
- > >Is it legal to cast from a function which expects a reference to one
- > >expecting a pointer, as in the sample code below.
- > >
-
- > No.
-
- It is legal to cast a pointer to a function into a pointer to a different
- type of function. Casting back to the original type is guaranteed to
- bring the original pointer back.
-
- But calling a function of one type through a pointer to a function of a
- different type results in undefined behavior.
- --
- Kevin J. Hopps e-mail: kjhopps@mmm.com
- 3M Company phone: (612) 737-4643
- 3M Center, Bldg. 235-2D-57 fax: (612) 737-2700
- St. Paul, MN 55144-1000 Opinions are my own. I don't speak for 3M.
- But 3M speaks for me -- I did not write the following line:
-
- Opinions expressed herein are my own and may not represent those of 3M.
-